import {Routes, RouterModule} from '@angular/router';
import {MainLayoutComponent} from "./shared/layout/app-layouts/main-layout.component";
import {AuthLayoutComponent} from "./shared/layout/app-layouts/auth-layout.component";
import {ModuleWithProviders} from "@angular/core";
import {AuthGuard} from "./auth-guard.service";
import {config} from './shared/smartadmin.config';

export const routes: Routes = [
  	{
	    path: '',
	    component: MainLayoutComponent,
	    data: {pageTitle: '让行业物流更智慧'},
	    canActivate: [AuthGuard],
		canActivateChild: [AuthGuard],
	    children: [
     		{path: '', redirectTo: 'home', pathMatch: 'full'},
      		{path: 'home', loadChildren: 'app/+home/home.module#HomeModule',data:{pageTitle: '首页'}},
			{path: 'home-page', loadChildren: 'app/+home-page/home-page.module#HomePageModule',data:{pageTitle: '首页'}},
    		{path: 'system', loadChildren: 'app/+system/system.module#SystemModule',data:{pageTitle: '系统基础配置'}},
    		{path: 'log-info', loadChildren: 'app/+log-info/log-info.module#LogInfoModule',data:{pageTitle: '日志管理'}},
    		{path: 'car', loadChildren: 'app/+car/car.module#CarModule',data:{pageTitle: '车辆管理'}},
    		{path: 'data-statistics', loadChildren: 'app/+data-statistics/data-statistics.module#DataStatisticsModule',data:{pageTitle: '数据统计'}},
    		{path: 'system-config', loadChildren: 'app/+system-config/system-config.module#SystemConfigModule',data:{pageTitle: '系统配置'}},
    		{path: 'data-management', loadChildren: 'app/+data-management/data-management.module#DataManagementModule',data:{pageTitle: '数据下载'}},
    		{path: 'device-management', loadChildren: 'app/+device-management/device-management.module#DeviceManagementModule',data:{pageTitle: '设备安装管理'}},
	    	{path: 'abnormal-alert', loadChildren: 'app/+abnormal-alert/abnormal-alert.module#AbnormalAlertModule',data:{pageTitle: '异常警告'}},
	    	{path: 'algorithm', loadChildren: 'app/+algorithm/algorithm.module#AlgorithmModule',data:{pageTitle: '算法管理'}},
	    	{path: 'langyun', loadChildren: 'app/+langyun/langyun.module#LangyunModule',data:{pageTitle: '朗云环卫管理'}},
	    	{path: 'video', loadChildren: 'app/+video/video.module#VideoModule',data:{pageTitle: '视频监控'}},
			{path: 'contract', loadChildren: 'app/+weixin/weixin.module#WeixinModule',data:{pageTitle: '合同管理'}},
			{path: 'api-monitor', loadChildren: 'app/+api-monitor/api-monitor.module#ApiMonitorModule',data:{pageTitle: 'api接口监控'}},
	    	{path: 'api-control', loadChildren: 'app/+api-control/api-control.module#ApiControlModule',data:{pageTitle: 'api接口管控'}},
			{path: 'statis', loadChildren: 'app/+statis/statis.module#StatisModule',data:{pageTitle: '统计报表'}},
			{path: 'bom', loadChildren: 'app/+bom/bom.module#BomModule',data:{pageTitle: '物料跟踪管理'}},
			{path: 'wx-bind', loadChildren: 'app/+wx-bind-car/wx-bind-car.module#WXBindCarModule',data:{pageTitle: '绑定车辆管理'}},
	    	{path: 'environment-manage', loadChildren: 'app/+environment-manage/environment-manage.module#EnvironmentManage',data:{pageTitle: '环卫运维管理'}},
			{path: 'transport-manage', loadChildren: 'app/+transport-manage/transport-manage.module#TransportManageModule',data:{pageTitle: '流向管控'}},
			{path: 'installation-management', loadChildren: 'app/+installation-management/installation-management.module#InstallationManagement',data:{pageTitle: '安装管理[环卫]'}},
			{path: 'supply-chain', loadChildren: 'app/+supply-chain/supply-chain.module#SupplyChainModule',data:{pageTitle: '供应链管理'}},
			{path: 'help-center', loadChildren: 'app/+home/home.module#HomeModule',data:{pageTitle: '帮助中心', link: 'Link', path: config.HELP_CENTER_EDIT_LINK_URL}},
	    ]
  	},
    {path: 'auth', component: AuthLayoutComponent, loadChildren: 'app/+auth/auth.module#AuthModule'},
	{path: '**', redirectTo: 'auth/error404'}
];

export const routing: ModuleWithProviders = RouterModule.forRoot(routes, {useHash: true});
